package com.o2o.util;

import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;

public class EmailUtil {
	public static boolean sendEmail(String emailAddr,String msg){
//		SimpleEmail email = new SimpleEmail();
		HtmlEmail email = new HtmlEmail(); 
		email.setHostName("smtp.163.com");
		email.setAuthentication("guozhenggang0", "13384724446");
		email.setCharset("UTF-8");
		try {
			email.addTo(emailAddr);
			email.setFrom("guozhenggang0@163.com","豌豆网");//必须和Authentication使用的用户相同，否则失败
			email.setSubject("豌豆网注册");
			email.setMsg(msg);
			email.send();
			return true;
		} catch (EmailException e) {
			//e.printStackTrace();
			return false;
		}
	}
}
